package chapter24

/**
 * Created by alex on 15-4-16.
 */
object Domain {

  def apply(parts: String*):String = {
    parts.reverse.mkString(".")
  }

  def unapplySeq(whole: String): Option[Seq[String]] = {
    Some(whole.split("\\.").reverse)
  }

}

object Run1 extends App {

  def matchs(domain: String): Boolean = {
    domain match {
      case EMail("tom", Domain("com",_*)) => true
      case _                             => false
    }
  }
}
